﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;

namespace QLKS.Converters
{
    class GiaPhongNgoaiTeConverter:IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            double giant = 0;
            double gia = 0;
            if (value == null)
                return 0;
            if (!double.TryParse(value.ToString(), out gia))
                return 0;
            string mant = parameter.ToString();
            switch (mant)
            {
                case "USD": giant = ViewModels.PhongViewModel.TinhGiaNgoaiTe(gia, mant);
                    break;
            }
            return giant;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
